Ruby - Overview of Data Retrieval
In This Topic
This section describes the six main classes used to retrieve data from an HttpWatch log file (.hwl) or from the Log property of the Plugin object.
Please refer to the Class Diagram to visualize the relationships between the classes described here.
Log Class
The Log object is the starting-point of a hierarchy that is used to hold the information recorded by HttpWatch.
It contains a number of properties that provide information about the whole log file, e.g:
The other properties in this class are used to access the page groups and HTTP transactions that were recorded:
Pages Class
The Pages class contains a list of Page objects - one for each page group that was recorded in the log file.
This class is one of the collection classes covered in Using Collection Classes. It has only two properties; the Count property which returns the number of Page objects and the Item property which returns a single Page object at a time from the collection.
Page Class
The Page class holds a page group that relates to the loading of a specific web page:
- Entries contains a list of the HTTP transactions required to download the page
- Title is the HTML title of the pad that was loaded
- Dynamic is a boolean property that indicates if this page was a dynamic update to an existing web page (e.g. it was modified by AJAX or JavaScript).
- Unknown is set to true if this Page object actually contains a single request that was not directly associated with a window or tab in the browser. (E.g. a request to download an icon for a bookmark or location bar.)
- Started, StartedSecs and StartedDateTime all return information about the time at which the download of this page was started
- Events contains any page level events that were recorded during the loading of the page (e.g. Page Load, Render Start)
Entries Class
The Entries class contains a list of Entry objects- one for each HTTP transaction that was recorded in the log file or associated page group.
Like the other collection classes it has properties for accessing the data objects it contains - the Count property which returns the number of Entry objects and the Item property which returns a single Entry object at a time from the collection.
The Entries object also has a another property, the Summary property, which returns summary information about the HTTP requests in this Entries object (see the Summary Class section below)
Entry Class
The Entry class represents a single HTTP transaction. The most commonly used properties are:
- URL returns the URL of the HTTP or HTTPS request
- IsComplete whether the request has finished processing.
- Request returns an object that holds information about the HTTP request message, e.g. cookies, POST data and query string values that were sent to the server
- Method contains the HTTP method used (e.g. "GET" or "POST").
- The Result property returns a string containing the result of the request, in the same format as displayed in HttpWatch. (E.g. "200", "(Cached)", etc.)
- Response returns an object that holds information about the HTTP response message, e.g. headers and chunking
- Content property returns an object that holds information about the downloaded resource, e.g. its contents and whether compression was used
- The size of the HTTP request message is available in the BytesSent property and the size of the response message in the BytesReceived property
- Time returns the length of time, in seconds, that was needed to complete the HTTP transaction
- The Timings property returns an object that contains detailed timing information, such DNS Lookup, Wait and Receive timings
Summary Class
The Summary class holds summary information about all the HTTP requests in an Entries collection such as:
- BytesSent returns the total number of bytes of data that have been sent to web server(s), i.e. the total size of all request headers and POST data.
- BytesReceived returns the total number of bytes of data that have been received from web server(s)—i.e. response headers and content.
- CompressionSavedBytes returns the total number of bytes by which downloaded content was reduced in size by HTTP compression.
- DNSLookups returns the total number of times that a network name (such as www.google.com) was converted to a numeric IP address (such as 72.14.221.103).
- TCPConnects returns the number of times that a new TCP-level connection had to be made with web server(s).
- The RoundTrips property returns the number of requests that caused HTTP request and response messages to be exchanged with a web server.
- StatusCodes returns an object that contains a list of the status codes that were returned by requests.
- Errors returns an object containing a list of the error codes that were returned by requests.
- Time returns the time in seconds from the start of the first request in the Entries collection to the end of the last item.